package com.yough.api.framework.core.message;

import org.dom4j.Element;

/**
 * @Description
 * @Author yough
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2021/1/14
 */
public interface IMessageHandler {

    /**
     * 将消息报文转换成实体Bean
     *
     * @param message
     * @param clazz
     * @return
     * @throws Exception
     */
    public Class<?> convertMessageToBean(String message, Class<?> clazz) throws Exception;

    /**
     * 获取报文的Service_Header节点
     *
     * @param xmlMessage
     * @return
     * @throws Exception
     */
    public Element getServiceHeaderNode(String xmlMessage) throws Exception;

    /**
     * 获取报文的Service_Body节点
     *
     * @param xmlMessage
     * @return
     * @throws Exception
     */
    public Element getServiceBodyNode(String xmlMessage) throws Exception;


    /**
     * 获取报文的request节点
     *
     * @param xmlMessage
     * @return
     * @throws Exception
     */
    public Element getRequestNode(String xmlMessage) throws Exception;

    /**
     * 获取报文的response节点
     *
     * @param xmlMessage
     * @return
     * @throws Exception
     */
    public Element getResponseNode(String xmlMessage) throws Exception;

    /**
     * 获取报文的ext_attributes节点
     *
     * @param xmlMessage
     * @return
     * @throws Exception
     */
    public Element getExtAttributesNode(String xmlMessage) throws Exception;

    /**
     * 将实体Bean转换成消息报文
     *
     * @param Bean
     * @param <T>
     * @return
     * @throws Exception
     */
    public <T> String convertBeanToMessage(T Bean) throws Exception;
}
